package com.weipai.springboot.module.mapper;

import com.weipai.springboot.model.MemberLevel;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;

/**
 * 会员等级
 */
public interface MemberLevelMapper extends Mapper<MemberLevel>, MySqlMapper<MemberLevel>{

    //查询数据
    List<MemberLevel> selectAllByDel(@Param("del")int del, 
                                     @Param("sort")String sort,
                                     @Param("way")String way);

    //查询会员等级详情
    MemberLevel getMemberLevelById(String id);

    //删除
    @Delete("update c_member_level set member_level_del=-1, del_time=date_format(now(), '%Y-%m-%d %H:%i:%s') " +
            "where member_level_id=#{id}")
    int updateDel(String id);
    
    //更改会员等级的状态
    //更改品牌的状态
    @Update("update c_member_level set member_level_status=#{status}, update_time=date_format(now(), '%Y-%m-%d %H:%i:%s') " +
            "where member_level_id=#{id}")
    int updateStatus(@Param("id") String id, @Param("status") Integer status);

    //批量删除
    int batchDeleteById(String[] id);
}